import BaseItemView from "../../../cfw/mvc/BaseItemView";
import { ItemState } from "../../../cfw/tools/Define";


const { ccclass, property } = cc._decorator;

@ccclass
export default class FoodItemVIew extends BaseItemView {

    @property(cc.Sprite)
    icon: cc.Sprite = null;

    @property(cc.Sprite)
    ad: cc.Sprite = null;

    start() {
        super.start();
        // if (!this.model.needBuy()) {
        //     if (this.ad) {
        //         this.ad.node.active = false;
        //     }
        // }z
    }

    getIcon(){
        return this.model.getIcon()
    }

    needBuy() {
        return this.model.needBuy()
    }

    updateState() {
        this.model.setState(ItemState.GOT)
        if (this.ad) {
            this.ad.node.active = false;
        }
    }

    // update (dt) {}
}
